<?php
/**
 * Menu
 * @author Tomas Srna
 * @package bakalarka
 */

class Menu
{
	protected $_children = array();
	
	public function __construct(array $children)
	{
		$this->_children = $children;
	}
	
	public function children()
	{
		return $_children;
	}
	
	public function __toString()
	{
		if(count($this->_children) < 1)
			return "";
		
		$r = "";
		$r .= "<ul>\n";
		foreach ($this->_children as $c) {
			if($c->allowed())
				$r .= "\t<li>".$c."</li>\n";
		}
		$r .= "</ul>\n";
		
		return $r;
	}
}
